//
//  UserDafaults.m
//  Cat
//
//  Created by lushitong on 2018/12/2.
//  Copyright © 2018年 lushitong. All rights reserved.
//

#import "UserDafaults.h"

@implementation UserDafaults


+ (instancetype)sharedInstance {
	static UserDafaults *instance;
	static dispatch_once_t onceToken;
	dispatch_once(&onceToken, ^{
		instance = [UserDafaults new];
	});
	return instance;
}

#pragma mark----- token -----

#define UDKeyKoken  @"UDKeykoken"

- (NSString *)userToken {
	return [self objectForKey:UDKeyKoken];
}

- (void)setUserToken:(NSString *)userToken {
	[self setObject:userToken forKey:UDKeyKoken];
}

#pragma mark----- phone -----

#define UDKeyPhone  @"UDKeyPhone"

- (NSString *)phone {
	return [self objectForKey:UDKeyPhone];
}

- (void)setPhone:(NSString *)phone {
	[self setObject:phone forKey:UDKeyPhone];
}

#define UDKeyRedPoint  [NSString stringWithFormat:@"UDKeyOpenCrystal-1.0.0"]

- (BOOL)redPoint {
	return [[self objectForKey:[self keyOfRedPoint]] boolValue];
}

- (void)setRedPoint:(BOOL)redPoint {
	[self setObject:@(redPoint) forKey:[self keyOfRedPoint]];
}

- (NSString *)keyOfRedPoint {
	return [NSString stringWithFormat:@"%@-%@",UDKeyRedPoint,UDKeyPhone];
}


@end
